//
//  ValidationLogMigration.swift
//  hello
//
//  Created by 赵康 on 2025/2/16.
//
import Fluent

extension ValidationLog {
  struct Migration: AsyncMigration {
    var name: String { "ValidationLog" }
    
    func prepare(on database: any Database) async throws {
      try await database.schema(ValidationLog.schema)
        .id()
        .field(ValidationLog.FieldKeys.albumId, .uuid, .required)
        .field(ValidationLog.FieldKeys.oldWordCount, .int, .required)
        .field(ValidationLog.FieldKeys.newWordCount, .int, .required)
        .field(ValidationLog.FieldKeys.createdAt, .datetime)
        .create()
    }
    
    func revert(on database: any Database) async throws {
      try await database.schema(ValidationLog.schema)
        .delete()
    }
  }
}
